from django.contrib import admin

# Register your models here.
from .models import *

#注册该模型
@admin.register(Order_1)
class Order_1Admin(admin.ModelAdmin):
    # 列表页面显示字段
    list_display = ['order_id', 'order_data','order_money_all','order_user','payway','pay_case','address','tel','trade_no','user']

#注册该模型
@admin.register(Order_2)
class Order_2Admin(admin.ModelAdmin):
    # 列表页面显示字段
    list_display = ['Order_food', 'Order_num','food_money','Order_id','Order_data','order_1']

#注册该模型
@admin.register(Order_lingshi)
class Order_lingshiAdmin(admin.ModelAdmin):
    # 列表页面显示字段
    list_display = ['img','food_name', 'food_num','food_money','user','eat_food']

#注册该模型
@admin.register(Comment)
class CommentAdmin(admin.ModelAdmin):
    # 列表页面显示字段
    list_display = ['comment','photo', 'lv','user','order_1']

# # 评论表
# class Comment(models.Model):
#     # 内容
#     comment = models.CharField(max_length=10000,default='')
#     # 照片
#     photo = models.ImageField(default='',upload_to='media/')
#     # 星级
#     lv = models.IntegerField()
#     # 一对多关联用户
#     user = models.ForeignKey(User,on_delete=models.CASCADE)
#     # 一对多关联订单
#     order_1 = models.ForeignKey(Order_1, on_delete=models.CASCADE)

# # 临时订单表
# class Order_lingshi(models.Model):
#     食品图片,RichTextUploadingField上传类型
#     img = RichTextUploadingField(config_name='my_config')
#     # 食品名称,models.CharField字符串类型
#     food_name = models.CharField(max_length=255)
#     # 购买数量,models.IntegerField数字类型
#     food_num = models.IntegerField()
#     # 金额
#     food_money = models.IntegerField()
#     # 一对多连接用户表
#     user = models.ForeignKey(User, on_delete=models.CASCADE)
#     一对多连接食品表
#     eat_food = models.ForeignKey(Eat_Food, on_delete=models.CASCADE)
#
# # 订单表
# class Order_1(models.Model):
#     # 订单编号,models.CharField字符串类型
#     order_id = models.CharField(max_length=255)
#     # 订单日期,models.DateField日期类型
#     order_data = models.DateTimeField()
#     # 订单总金额
#     order_money_all = models.IntegerField()
#     # 下单用户,models.CharField字符串类型
#     order_user = models.CharField(max_length=255)
#     支付状态
#     pay_case = models.CharField(max_length=255,default='未支付')
#     收货地址
#     address = models.CharField(max_length=255)
#     收货人电话
#     tel = models.CharField(max_length=255)
#     一对多连接用户表
#     user = models.ForeignKey(User,on_delete=models.CASCADE)
#
#     def __str__(self):
#         return "%s" % self.order_id
#
# # 订单明细表
# class Order_2(models.Model):
#     # 食品名称,models.CharField字符串类型
#     Order_food = models.CharField(max_length=255)
#     # 购买数量,models.IntegerField数字类型
#     Order_num = models.IntegerField()
#     # 金额
#     food_money = models.IntegerField()
#     # 对应订单编号,models.CharField字符串类型
#     Order_id = models.CharField(max_length=255)
#     # 对应订单日期,models.CharField字符串类型
#     Order_data = models.CharField(max_length=255)
#     # 一对多连接订单表
#     order_1 = models.ForeignKey(Order_1, on_delete=models.CASCADE)